home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_8 / issue_06 / risc_os / Wimp / Obey < prev    next >
Encoding:
Text File  |  1988-12-06  |  2.1 KB  |  66 lines

  1. > Wimp.Obey
  2.  
  3. New Calls
  4. ---------
  5.  
  6.         *Obey
  7.  
  8.  
  9. *Obey
  10. -----
  11.  
  12. A new module, Obey, has been written to allow text files containing *commands
  13. to be executed directly, rather than by using *EXEC and assuming that the
  14. foreground task is sending keyboard input to OS_CLI.
  15.  
  16.         Syntax:  *Obey <filename> [<parameters>]
  17.  
  18. The command also automatically sets the variable Obey$Dir to the name of the
  19. parent directory containing the file, by extracting it from the <filename>
  20. provided.  The absoluteness of this pathname depends on how absolute the
  21. original filename was (eg. *Obey fred.jim leaves Obey$Dir = "fred", which is
  22. all very well until the current directory changes!)
  23.  
  24. Any references to %0 to %9 within the file are taken to be references to the
  25. parameters on the original command line, so it is possible to pass parameters
  26. to these files.  This does mean, however, that commands which want to specify
  27. %0 literally must use %%0 instead.  Note that %*0 gives the whole of the
  28. command line after the <filename>.
  29.  
  30. It is recommended that programs which want to keep a tag on their parent
  31. directory execute a command of the following form within their Obey file:
  32.  
  33.         *Set foo$dir <Obey$Dir>
  34.  
  35. Thereafter the parent directory can be referenced by using <foo$dir> in
  36. filenames.
  37.  
  38. Obey files are the recommended way of starting up Wimp programs (see
  39. Wimp.Install for full details).
  40.  
  41.  
  42. Finding the parent directory
  43. ----------------------------
  44.  
  45. The parent directory is found by stripping '.<leafname>' from the end of the
  46. filename given to *Obey, which may contain an element from Run$Path combined
  47. with the name specified in the original command.  For example,
  48.  
  49.         *Set Run$Path adfs::Winnie.Deskworld.-
  50.         *foo xyz
  51.  
  52. would produce the equivalent of:
  53.  
  54.         *Run adfs::Winnie.Deskworld.-foo xyz
  55.  
  56. which (if -foo.!Run has filetype &FEB) would produce the equivalent of:
  57.  
  58.         *Obey adfs::Winnie.Deskworld.-foo.!Run xyz
  59.  
  60. The latter conversion is achieved by a combination of the FileSwitch
  61. treatment of !Run files, and the setting-up of the filetype &FEB as follows:
  62.  
  63.         *Set Alias$@RunType_FEB Obey %*0
  64.         *Set File$Type_FEB Obey
  65.  
  66.